11110 - Equidivisions (DFS, maratón colombiana) &&
[andmenj-acm.git] / 11461 - Square numbers / 11461.cpp
blob41527669acf53e54446fe57b3187c3a298c7c421
1 #include <iostream>
2 #include <algorithm>
3 #include <cmath>
4 using namespace std;
6 const int SIZE = 100000;
8 int f[SIZE+1];
10 int main(){
11 f[0] = 0;
12 int k;
13 for (int i=1; i<=SIZE; ++i){
14 f[i] = f[i-1] + ((k = (int)sqrt(i)) * k == i);
16 int a, b;
17 while (cin >> a >> b && a+b){
18 if (a > b) swap(a, b);
19 cout << f[b] - f[a-1] << endl;
21 return 0;